//
//  SeeRefundingViewController.m
//  HongFuShop
//
//  Created by chirui on 2017/9/8.
//  Copyright © 2017年 Shui. All rights reserved.
//

#import "SeeRefundingViewController.h"

@interface SeeRefundingViewController ()

{
    
    NSString * urlStr;
}

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation SeeRefundingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.view.backgroundColor =[UIColor whiteColor];
    
    self.navigationItem.titleView = [TopLabel withLabelWithLabelText:@"退换货"];
    
    [self getNetWorking];
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithIcon:@"icon_public_return" target:self action:@selector(backButton)];
}

-(void)backButton {
    
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)creatWebWith:(NSString *)str {
    
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,WIDTH, HEIGHT-64)];
    _webView.scalesPageToFit = YES;
    
    NSURL* url =[NSURL URLWithString:str];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:request];
    
    [self.view addSubview:self.webView];
    
}

// 网络请求
-(void)getNetWorking {
    
    NSString * parametersStr = [NSString stringWithFormat:@"%@%@",NetWorkAddress_api,get_returnGoods_api];
    
    
    SHuiMBhubNoTimeLoding;
    [PostNetWorking postNetWorkingStr:parametersStr  andparameters:nil  Success:^(id responseObject) {
        SHuiMBHidleYes;
        if ([responseObject[@"code"] intValue]==200) {
            
            urlStr = responseObject[@"datas"][@"url"];
            [self creatWebWith:urlStr];
            
        } else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
        
    } failed:^(NSError *error) {
        SHuiMBHidleYes;
        SHuiMBhudTextNetError;
        
    }];
    //
    
}

@end
